<template>
  <div id="TwoRepresentations">  

    <el-form ref="form" :model="form" label-width="80px">  
     <el-row> 

        <el-col :span="18" style="display:flex;">


           <el-form-item label="" label-width="0px" style="margin-left:10px;" >
                 <el-date-picker type="date" :clearable='false'  placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time" style="width:160px;"></el-date-picker>
            </el-form-item>

            <el-form-item label-width="0px" style="margin-left:10px;">
               <el-input v-model="form.phone" placeholder="账户" style="width:160px;"></el-input>
            </el-form-item>


           <div class="custom_button2"  style="margin-left:10px;" @click="search_but"></div>
        </el-col>

        <el-col :span="6" style="text-align: right;">     
            <el-button type="primary" class="custom_color_button" style="margin-bottom:10px;" @click="refresh_but()">刷新</el-button>            
        </el-col>
    
    </el-row> 
   
   </el-form>
   <!-- 渲染数据list -->
   <two-representations-list :datalist="datalist" @up_list_fun="list_fun"> </two-representations-list>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>

    
      
  </div>
</template>

<script>

import TwoRepresentationsList from '@/view/Aftersale/Representations/TwoRepresentationsList'
export default {
  name: 'TwoRepresentations',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,
        form:{
          time:'',
          phone:'',
        },
    }
  },
 components:{
    TwoRepresentationsList
  },
  created(){
     this.list_fun()
  },
  mounted (){
    
  },
  methods: {
      list_fun(){
          this.post("/trade_goods/listOfAppealData", {
              page:this.page,
              onetime:this.form.time,
              telphone:this.form.phone,
              search_all:0 //0 分页 1 全部
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list

              for(let item of this.datalist) {

                item.voucher_linkList = [this.urlimg + item.voucher_link]  //首次上传凭证图片
                item.again_voucher_linkList = [this.urlimg + item.again_voucher_link]  //重新上传凭证图片
                 item.reason_picturelist =  [this.urlimg + item.reason_picture]  //驳回图片

                item.appeal_picturelist =  [this.urlimg + item.appeal_picture]  //申述图片
              }

            console.log(res)
         })
      },
      search_but(){
        this.page = 1
        this.list_fun()
      },
      refresh_but(){
        this.page = 1
        this.form={
          time:'',
          phone:'',
        }
        this.list_fun()
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
</style>
